package cn.hzu580.action;

import java.io.InputStream;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import cn.hzu580.entity.Notice;
import cn.hzu580.service.NoticeService;
import cn.hzu580.vo.NoticeVO;

@Controller
@Scope("prototype")
public class NoticeAction extends ActionSupport implements ModelDriven<NoticeVO> {

	private InputStream inputStream;
	
	@Resource(name="notice")
	private NoticeService noticeService;
	
	private NoticeVO noticeVO;
	
	private Notice json;
	
	private List<Notice> jsonArray;
	

	public String getAllNotices() throws Exception{
		jsonArray = noticeService.getAll();
		return "json_array";
	}


	public void read() throws Exception{
		noticeService.read(noticeVO);
	}


	public void readAll() throws Exception{
		noticeService.readAll();
	}


	public void clear() throws Exception{
		noticeService.clear();
	}
	
	
	public InputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}

	public NoticeService getNoticeService() {
		return noticeService;
	}

	public void setNoticeService(NoticeService noticeService) {
		this.noticeService = noticeService;
	}

	public NoticeVO getNotice() {
		return noticeVO;
	}

	public void setNotice(NoticeVO notice) {
		this.noticeVO = notice;
	}

	@Override
	public NoticeVO getModel() {
		noticeVO = new NoticeVO();
		return noticeVO;
	}


	public NoticeVO getNoticeVO() {
		return noticeVO;
	}


	public void setNoticeVO(NoticeVO noticeVO) {
		this.noticeVO = noticeVO;
	}


	public Notice getJson() {
		return json;
	}


	public void setJson(Notice json) {
		this.json = json;
	}


	public List<Notice> getJsonArray() {
		return jsonArray;
	}


	public void setJsonArray(List<Notice> jsonArray) {
		this.jsonArray = jsonArray;
	}
	
	
	
}
